package com.kmxd.ams.core.common.enums;

import com.kmxd.ams.core.common.constant.ErrorCode;
import com.kmxd.ams.core.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * ocr部署
 *
 * @author nickbi
 */
@Getter
@AllArgsConstructor
public enum OcrDeployTypeEnum {
  /** 挂接电子文件 */
  SINGLE("single", "单节点"),
  SINGLE_OTHER_END("single_other_end", "单节点不同端"),
  MULTIPLE("multiple", "多节点"),
  ;

  private String code;
  private String desc;

  public static OcrDeployTypeEnum convert(String type) {
    return Arrays.stream(values())
        .filter(x -> x.code.equals(type))
        .findAny()
        .orElseThrow(() -> BizException.instance(ErrorCode.NOT_FOUND, "未找到的数据库类型：" + type));
  }
}
